/* import Home from "@/pages/Home";
import Search from "@/pages/Search";
import Login from "@/pages/Login";
import Register from "@/pages/Register";
import Detail from "@/pages/Detail";
import AddCartSuccess from "@/pages/AddCartSuccess";
import ShopCart from "@/pages/ShopCart";
import Trade from "@/pages/Trade";
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess';
import Center from '@/pages/Center';
import myOrder from '@/pages/Center/myOrder';
import groupOrder from '@/pages/Center/groupOrder'; */

export default [

  {
    path: "/center",
    component:()=>import("@/pages/Center"),
    //访问center时直接重定向到myorder.
    redirect: '/center/myorder',
    meta: { show: true },
    children:[
      {
        path:'myorder',
        component:()=>import("@/pages/Center/myOrder"),
      },
      {
        path:'grouporder',
        component:()=>import("@/pages/Center/groupOrder"),
      },
    ]
  },
  {
    path: "/paysuccess",
    component:()=>import("@/pages/PaySuccess"),
    meta: { show: true },
  },
  {
    name: "pay",
    path: "/pay",
    component:()=>import("@/pages/Pay"),
    meta: { show: true },
    beforeEnter: (to, from, next) => {
      if(from.path=='/trade'){
        next()
      }else{
        next(false)
      }
    }
  },
  {
    name: "trade",
    path: "/trade",
    component:()=>import("@/pages/Trade"),
    meta: { show: true },
    //路由的独享守卫
    beforeEnter: (to, from, next) => {
      if(from.path=='/shopcart'){
        next()
      }else{
        next(false)
      }
    }
  },
  {
    name: "shopcart",
    path: "/shopcart",
    component:()=>import("@/pages/ShopCart"),
    meta: { show: true },
  },
  {
    name: "detail",
    path: "/detail/:skuid",
    component:()=>import("@/pages/Detail"),
    meta: { show: true },
  },
  {
    path: "/home",
    component:()=>import("@/pages/Home"),
    meta: { show: true },
  },
  {
    name: "search",
    path: "/search/:keyword?", //加个问号可以指定params参数可传可不传
    component:()=>import("@/pages/Search"),
    meta: { show: true },
    props(route) {
      return {
        keyword: route.params.keyword,
      };
    },
  },
  {
    path: "/login",
    component:()=>import("@/pages/Login"),
    meta: { show: false },
  },
  {
    path: "/register",
    component:()=>import("@/pages/Register"),
    meta: { show: false },
  },
  {
    path: "/addcartsuccess",
    name: "addcartsuccess",
    component:()=>import("@/pages/AddCartSuccess"),
    meta: { show: false },
  },
  //重定向，在项目跑起来的时候，访问/，立马让它定向到首页
  {
    path: "*",
    redirect: "/home",
  },
];
